<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id='app' v-cloak>
    <!-- <cpn cmovies="movies" cmessage="message"></cpn> -->
    <cpn :cmovies="movies" :cmessage="message"></cpn>
  </div>
  <template id="cpn">
    <div>
      <ul>
        <li v-for="item in cmovies">{{item}}</li>
      </ul>
      <p>{{cmessage}}</p>
    </div>
  </template>
  <script src='../js/vue.js'></script>
  <script>
    // 驼峰用法
    //   cInfo 
    //   : c - info = "info"
    // 1. props(父组件往子组件传值)  子组件向父组件传通过自定义事件
    const cpn = {
      template: '#cpn',
      // props: ['cmovies', 'cmessage'],
      props: {
        //数据验证：String,Number,Boolean,Array,Object,Date,Function,Symbool
        cmovies: Array,
        cmessage: String
      },
      data() {
        return {}
      },
      methods: {

      },
    }

    const app = new Vue({
      el: '#app',
      data: {
        message: 'hello Vue',
        movies: ['我是一个', '哈喽Vue']
      },
      components: {
        cpn
      }
    })
  </script>
  <style>
    [v-cloak] {
      display: none;
    }
  </style>
</body>

</html>